<?php
/**
 * User: ailuoga
 * Created Time: 2017/1/22 21:46
 * Description :
 */

namespace App\Presenters;


use Illuminate\Pagination\LengthAwarePaginator;

class CommonPresenter
{

    /**
     * @param $items LengthAwarePaginator
     * @return string
     */
    public function showPaginate($items){
        if ($items && $items instanceof LengthAwarePaginator){
            $links=$items->links();
            $currentPage=$items->currentPage();
            $lastPage=$items->lastPage();
            $total=$items->total();
            return <<<EOT
            <div class="box-footer clearfix">
                <div class="pull-right">
                    $links
                </div>
                Showing $currentPage to $lastPage  of $total entries
            </div>
EOT;
        }else{
            return '';
        }
    }
}